package vista;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;

import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;

import javax.swing.WindowConstants;
import javax.swing.SwingUtilities;

import bean.JTextFieldValidator;


public class JFFraseBasico extends javax.swing.JFrame {
	private JPanel pnlfrase;
	private JTextFieldValidator txtfrase;
	private JLabel lblcodigo;
	private JLabel lbl2;
	private JButton btnaceptar;
	private JLabel lbl1;

	public JFFraseBasico() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("Frase Nivel Básico");
			{
				pnlfrase = new JPanel();
				getContentPane().add(pnlfrase, BorderLayout.CENTER);
				pnlfrase.setLayout(null);
				pnlfrase.setPreferredSize(new java.awt.Dimension(380, 201));
				{
					txtfrase = new JTextFieldValidator(JTextFieldValidator.SOLO_LETRAS);
					pnlfrase.add(txtfrase);
					txtfrase.setBounds(43, 71, 302, 37);
					txtfrase.setSize(300, 30);
					txtfrase.setFont(new java.awt.Font("Purisa",1,14));
				}
				{
					lbl1 = new JLabel();
					pnlfrase.add(lbl1);
					lbl1.setText("Indroduzca la Frase:");
					lbl1.setFont(new java.awt.Font("Purisa",1,16));
					lbl1.setBounds(37, 27, 229, 27);
				}
				{
					btnaceptar = new JButton();
					pnlfrase.add(btnaceptar);
					btnaceptar.setText("Aceptar");
					btnaceptar.setFont(new java.awt.Font("Purisa",1,14));
					btnaceptar.setBounds(143, 150, 100, 30);

				}
				{
					lbl2 = new JLabel();
					pnlfrase.add(lbl2);
					lbl2.setText("Debe Introducir Una(1) Palabra");
					lbl2.setBounds(97, 114, 196, 15);
					lbl2.setFont(new java.awt.Font("Purisa",0,10));
				}
				{
					lblcodigo = new JLabel();
					pnlfrase.add(lblcodigo);
					lblcodigo.setText("1");
					lblcodigo.setBounds(333, 21, 21, 19);
					lblcodigo.setVisible(false);
				}
			}
			pack();
			this.setSize(389, 242);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}

	public JTextFieldValidator getTxtfrase() {
		return txtfrase;
	}

	public void setTxtfrase(JTextFieldValidator txtfrase) {
		this.txtfrase = txtfrase;
	}
	public void mostrarMensaje(String mensaje)
	{
		JOptionPane.showMessageDialog(this, mensaje);
	}

	public JLabel getLblcodigo() {
		return lblcodigo;
	}

	public void setLblcodigo(JLabel lblcodigo) {
		this.lblcodigo = lblcodigo;
	}
	public void Limpiar()
	{
		txtfrase.setText(" ");
	}
	public void addListener (ActionListener actionListener)
	{
		this.btnaceptar.addActionListener(actionListener);
	}

}
